package com.uphone.edwards.http;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;

/**
 * Created by hzy on 2019/1/10
 * ApiService
 *
 * @author Administrator
 */
public interface ApiService {

    // 服务器url
    public final static String HttpApi = "http://118.187.6.38:8099/edward-rest/api/";

    @Multipart
    @POST("user/highScoreUpload")
    Observable<ResponseBody> userHightScoreUpload(@PartMap Map<String, RequestBody> params,
                                                  @Part MultipartBody.Part file);

    @POST()
    Observable<ResponseBody> postService(@Url String url, @Body RequestBody params);


    // 注册--获取地址
    @POST("getLocations")
    @FormUrlEncoded
    Observable<ResponseBody> getLocations(@Field("langId") String langId);
    // 注册--邮箱验证码
    @POST("sendRegEmail")
    @FormUrlEncoded
    Observable<ResponseBody> sendLoginEmail(@Field("langId") String langId , @Field("email") String email , @Field("userName") String userName);
    // 注册--确定注册
    @POST("regist")
    @FormUrlEncoded
    Observable<ResponseBody> regist(
            @Field("langId") String langId,
            @Field("location") String langIlocationd,
            @Field("userName") String userName,
            @Field("department") String department,
            @Field("employeesNo") String employeesNo,
            @Field("enterpriseEmail") String enterpriseEmail,
            @Field("title") String title,
            @Field("code") String code

    );
    // 登录--邮箱登录
    @POST("login")
    @FormUrlEncoded
    Observable<ResponseBody> login(@Field("langId") String langId , @Field("email") String email , @Field("code") String code);
    // 登录--邮箱验证码
    @POST("sendLoginEmail")
    @FormUrlEncoded
    Observable<ResponseBody> sendLoginEmail(@Field("langId") String langId , @Field("email") String email);
    // 用户信息--获取
    @POST("getUserInfo")
    @FormUrlEncoded
    Observable<ResponseBody> getUserInfo(@Field("langId") String langId , @Field("token") String token);
    // 用户信息--修改
    @POST("modifyUserInfo")
    @FormUrlEncoded
    Observable<ResponseBody> modifyUserInfo(@Field("langId") String langId ,
                                            @Field("token") String token,
                                            @Field("employeesNo") String employeesNo ,
                                            @Field("title") String title ,
                                            @Field("userName") String userName ,
                                            @Field("enterpriseEmail") String enterpriseEmail ,
                                            @Field("department") String department ,
                                            @Field("location") String location
                                            );
    // 手册/期刊 banner图
    @POST("banner")
    @FormUrlEncoded
    Observable<ResponseBody> banner(@Field("token") String token
            , @Field("langId") String langId);

    // 开始阅读手册
    @POST("startReading")
    @FormUrlEncoded
    Observable<ResponseBody> startReading(@Field("token") String token
            , @Field("contentId") String contentId);
    // 获取手册目录
    @POST("getContents")
    @FormUrlEncoded
    Observable<ResponseBody> getContents(@Field("token") String token
            , @Field("langId") String langId);
    // 保存阅读记录(用户点击期刊连接后, 需要调用接口)
    @POST("saveRecord")
    @FormUrlEncoded
    Observable<ResponseBody> saveRecord(@Field("token") String token
            , @Field("publicationId") String publicationId);
    // 是否有NEW提示
    @POST("hasNew")
    @FormUrlEncoded
    Observable<ResponseBody> hasNew(@Field("token") String token
            , @Field("langId") String langId);
    // 获取期刊数据
    @POST("getPublication")
    @FormUrlEncoded
    Observable<ResponseBody> getPublication(@Field("token") String token
            , @Field("langId") String langId);
}
